var core        = require("core")
,   mongoose    = require("mongoose")
,   db          = core.db
,   dbPlugin    = db.plugin
,   utils       = core.utils
,   Schema      = mongoose.Schema
,   name        = "User";

var User = function(){

    var options = {
        uid     : { type: Number, index: true },
        name    : { type: String },
        pwd     : { type: String },
        image   : { type: String, default: "/assets/default/user_img.png" },
        openid  : { type: String },
        auth    : { type: String, default: "1" },
        status  : { type: Boolean, default: false }
    };

    var SessionSchema = new Schema(options);

    SessionSchema.plugin(dbPlugin.increment, {
        model       : name,
        field       : "uid",
        start       : 0,
        increasing  : 1
    });

    return SessionSchema;

};

module.exports = User;
